function t(t) {
    if (Array.isArray(t)) {
        for (var a = 0, e = Array(t.length); a < t.length; a++) e[a] = t[a];
        return e;
    }
    return Array.from(t);
}

var a = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(t) {
    return typeof t;
} : function(t) {
    return t && "function" == typeof Symbol && t.constructor === Symbol && t !== Symbol.prototype ? "symbol" : typeof t;
};

Page({
    data: {
        pass: !1,
        noPass: !1,
        page_loading: !0,
        actions: [ {
            name: "取消",
            color: "#666666"
        }, {
            name: "确认",
            color: "#446dfd",
            loading: !1
        } ],
        id: null,
        status: null,
        detail: {},
        transfer_rate: "",
        remark: ""
    },
    onLoad: function(t) {
        getApp().page.onLoad(this,t)
        if (this.data.store.is_shenhe == 0) {
            wx.setNavigationBarTitle({
                title: '入住商详情'
            })
        }
        var e = this, i = t.id;
        this.setData({
            id: i
        }), getApp().core.showLoading({
            content: "加载中",
        }), getApp().request({
            url: getApp().api.admin.mch.review_detail,
            data: {
                id: i
            },
            method: "get",
            success: function (t) {
              getApp().core.hideLoading();
              if (0 == t.code) {
                var i = t.data.detail;
                e.setData({
                  detail: i
                });
              } else getApp().core.showToast({
                title: t.msg,
                icon: 'none'
              });
            },
            fail: function(t) {
              getApp().core.showToast({
                title: t.data.msg,
                icon: 'none'
              });
            }
        });
    },
    look: function(t) {
        var a = t.currentTarget.dataset.src;
        getApp().api.previewImage({
            current: a,
            urls: [ a ]
        });
    },
    input: function(t) {
        this.setData({
            transfer_rate: t.detail.value
        });
    },
    remark: function(t) {
        this.setData({
            review_remark: t.detail.value
        });
    },
    toPass: function(t) {
        this.setData({
            pass: !this.data.pass
        });
    },
    toRefuse: function(t) {
        this.setData({
            noPass: !this.data.noPass
        });
    },
    handleClick: function(a) {
        var e = a.detail;
        this.setData({
            status: 1
        });
        var i = e.index;
        0 === i ? this.setData({
            pass: !this.data.pass
        }) : 1 === i && ([].concat(t(this.data.actions))[1].loading = !0, this.data.detail.review_status = 1, 
        this.data.detail.transfer_rate = this.data.transfer_rate, this.submit());
    },
    handleClose: function(a) {
        var e = a.detail;
        this.setData({
            status: 2
        });
        var i = e.index;
        0 === i ? this.setData({
            noPass: !this.data.noPass
        }) : 1 === i && ([].concat(t(this.data.actions))[1].loading = !0, this.data.detail.review_status = 2, 
        this.data.detail.review_remark = this.data.remark, this.submit());
    },
    submit: function() {
        var a = this;
        getApp().core.showLoading({
            type: "loading"
        });
        var e = JSON.stringify(this.data.detail);
         getApp().request({
            url: getApp().api.admin.mch.review_switch,
            data: {
                type: 1,
                status: a.data.status,
                mch: a.data.id,
                review_remark: a.data.review_remark,
                transfer_rate: a.data.transfer_rate
            },
            method: "post",
            success: function(e) {
              getApp().core.hideLoading(), 0 == e.code ? (getApp().core.showToast({
                title: e.msg,
                icon: 'none'
              }), a.setData({
                pass: !1,
                noPass: !1
              }), getApp().core.navigateBack()) : getApp().core.showToast({
                title: e.msg,
                icon: 'none'
              });
            },
            fail: function() {
              getApp().core.showToast({
                title: t.msg,
                icon: 'none'
              });
            }
        });
    },
    onReady: function(t) {
        this.setData({
            page_loading: !1
        });
    },
    onShow: function() {},
    onHide: function() {},
    onUnload: function() {},
    onPullDownRefresh: function() {},
    onReachBottom: function() {},
    onShareAppMessage: function() {}
});